package com.sso.filter;

import org.springframework.beans.factory.annotation.Value;

import javax.servlet.*;
import java.io.IOException;

/**
 * 类 {@code MyFilter} 我自己的拦截器 <br> 我自己的拦截器.
 *
 * <p>详细描述
 * <p>
 * @author <a href="mailto:lz2392504@gmail.com">CN華少</a>
 * @see Filter
 * @since v1.0.0
 */
public class MyFilter implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        Filter.super.init(filterConfig);
    }

    @Value("${my.test}")
    private String test;

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("已进入拦截器"+test);

        filterChain.doFilter(servletRequest, servletResponse);
    }

    @Override
    public void destroy() {
        Filter.super.destroy();
    }
}
